"""
__author__ = '霍格沃兹测试开发学社'
__desc__ = '更多测试开发技术探讨，请访问：https://ceshiren.com/t/topic/15860'
"""
from selenium.webdriver.common.by import By

from web_practice.prepare.web_po.page.base_page import BasePage
from web_practice.prepare.web_po.page.contact_page import ContactPage
from web_practice.prepare.web_po.utils.log_util import logger


class AddMemberPage(BasePage):
    __INPUT_USERNAME = (By.ID, "username")
    __INPUT_ACCID = By.ID, "memberAdd_acctid"
    __INPUT_MOBILE = (By.ID, "memberAdd_phone")
    __BTN_SAVE = By.CSS_SELECTOR, ".js_btn_save"

    def fill_into_info(self, username, accid, mobile):
        # input name
        # input accid
        # input phonenumber
        # 3. 填写成员信息
        logger.info("填写成员信息")
        # 3.1 输入用户名
        self.do_send_keys(username, self.__INPUT_USERNAME)
        # 3.2 输入acctid
        self.do_send_keys(accid, self.__INPUT_ACCID)
        # 3.3 输入手机号
        self.do_send_keys(mobile, self.__INPUT_MOBILE)

        # 3.4 点击保存
        self.do_find(self.__BTN_SAVE).click()
        return ContactPage(self.driver)
